class Article < ActiveRecord::Base
	paginates_per 10
  has_many :images

  def title_ellipsis(length=18)
    if self && self.title.length > 18
      return self.title[0,17] + '...'
    end
    self.title
  end
  
  def str_safe
    return '' unless self.content
    sc = self.content
    sc.gsub!(Regexp.new('[\"]'), "'")
    sc.gsub!(Regexp.new("[\n\r]"), "")
    sc
  end
end
